package com.yikes.yygh.mybatis.base;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 实体公共类
 * </p>
 *
 * @Author: guanrong.yin
 * @Date: 2024/12/3 20:45
 */
@Data
public class BaseEntity implements Serializable {

    /**
     * 创建时间
     */
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    @JsonInclude(value = JsonInclude.Include.NON_NULL)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdTime;

    /**
     * 更新时间
     */
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    @JsonInclude(value = JsonInclude.Include.NON_NULL)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedTime;

    /**
     * 创建人
     */
    @TableField("created_user")
    private String createdUser;

    /**
     * 更新人
     */
    @TableField("updated_user")
    private String updatedUser;

    /**
     * 删除标记（0: 删除，1: 正常）
     */
    @TableLogic
    @TableField("is_deleted")
    private Boolean deleted;

}
